const fs = require("fs");

console.log("开始读取androidmanifest.xml");

let manifestPath = process.argv[2] +"/AndroidManifest.xml";
let nowPackName = process.argv[3];
let toPackName = process.argv[4];

console.log("manifestPath==", manifestPath);
console.log("nowPackName==", nowPackName);
console.log("toPackName==", toPackName);

if (fs.existsSync(manifestPath)) {
    let tempContent = fs.readFileSync(manifestPath).toString();
    if (tempContent.indexOf(nowPackName) != -1) {
        tempContent = tempContent.replace(nowPackName, toPackName);
        fs.writeFileSync(manifestPath, tempContent);
    }
    console.log("重写manifestfinish");
}
